package com.example.module_visitor.adapter

import android.graphics.Color
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.module_visitor.R

class VisitorItemAdapter:BaseQuickAdapter<String,BaseViewHolder>(R.layout.visitor_item_type) {
    private var index = 0
    fun setIndex(int: Int){
        index = int
    }
    override fun convert(holder: BaseViewHolder, item: String) {
        if (index == holder.position){
            holder.setText(R.id.visitor_type,item)
                .setTextColor(R.id.visitor_type,Color.parseColor("#1E88E5"))
                .setBackgroundResource(R.id.visitor_type,R.drawable.shape_type_bg1)
        }else{
            holder.setText(R.id.visitor_type,item)
                .setTextColor(R.id.visitor_type,Color.parseColor("#4B5563"))
                .setBackgroundResource(R.id.visitor_type,R.drawable.shape_type_bg)
        }

    }
}